package com.sgzn.sgpay.service.impl;

import com.sgzn.sgpay.enums.SgsResponseCode;
import com.sgzn.sgpay.model.request.SgsIncreaseCreditQueryPageRequest;
import com.sgzn.sgpay.model.request.SgsMainOrderQueryPageRequest;
import com.sgzn.sgpay.model.response.SgsResultResponse;
import com.sgzn.sgpay.model.response.result.MainOrderQueryPageResult;
import com.sgzn.sgpay.service.SgsIncreaseCreditQueryService;
import com.sgzn.sgpay.service.support.SgsResponseUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 游戏记录（上分记录）询服务接口实现类
 * @author huangsenguang
 * @version Id: SgsIncreaseCreditQueryServiceImpl.java, v 0.1 2018/5/6 13:46 huangsenguang Exp $$
 */
@Slf4j
@Service
public class SgsIncreaseCreditQueryServiceImpl implements SgsIncreaseCreditQueryService {

    @Autowired
    private SgsMainOrderServiceImpl sgsMainOrderServiceImpl;

    @Override
    public SgsResultResponse<MainOrderQueryPageResult> queryPage(SgsIncreaseCreditQueryPageRequest request) {
        try {
            SgsMainOrderQueryPageRequest target = new SgsMainOrderQueryPageRequest();
            target.setPageQueryParam(request.getPageQueryParam());
            target.setInitiationID(request.getInitiationID());
            target.setReqTime(request.getReqTime());
            target.setLoginChannel(request.getLoginChannel());
            target.setUserId(request.getUserId());
            target.setOrderType(request.getOrderType());
            return this.sgsMainOrderServiceImpl.queryPage(target);
        } catch (Exception e) {
            log.error("上分记录查询服务异常: ", e);
        }
        return SgsResponseUtil.INSTANCE.fail(SgsResponseCode.C503.getResponseCode(),SgsResponseCode.C503.getResponseDesc());
    }

}

